package com.xyy.saas.payment.service.impl;

import com.xyy.saas.payment.dao.mapper.RoyaltyOrderMapper;
import com.xyy.saas.payment.dao.mapper.SettleOrderMapper;
import com.xyy.saas.payment.dao.model.RoyaltyOrder;
import com.xyy.saas.payment.dao.model.SettleOrder;
import com.xyy.saas.payment.service.SettleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author wangtianqi
 */
@Service
@DependsOn({"royaltyOrderMapper"})
public class SettleServiceImpl implements SettleService {

    @Autowired
    private RoyaltyOrderMapper royaltyOrderMapper;

    @Autowired
    private SettleOrderMapper settleOrderMapper;


    @Override
    public int updateRoyaltyOrderStatusByIds(List<Long> ids, Byte status) {
       return royaltyOrderMapper.updateStatusByPrimaryKeyList(ids, status);
    }

    @Override
    public List<RoyaltyOrder> selectRoyaltyOrderByPayNo(String payNo) {
        return royaltyOrderMapper.selectRoyaltyOrderByPayNo(payNo);
    }

    @Override
    public List<RoyaltyOrder> selectRoyaltyOrderByPayNoAndUserId(String payNo, String userId) {
        return royaltyOrderMapper.selectRoyaltyOrderByPayNoAndUserId(payNo, userId);
    }

    @Override
    public List<RoyaltyOrder> selectRoyaltyOrderByPayNosAndUserId(List<String> payNos, String userId) {
        return royaltyOrderMapper.selectRoyaltyOrderByPayNosAndUserId(payNos, userId);
    }

    @Override
    public List<RoyaltyOrder> selectRoyaltyOrderBySettleNo(String settleNo) {
        return royaltyOrderMapper.selectRoyaltyOrderBySettleNo(settleNo);
    }


    @Override
    public int updateRoyaltyOrderSettleNoById(Long id, String settleNo) {
        return royaltyOrderMapper.updateSettleOrderNoByPrimaryKey(id, settleNo);
    }


    @Override
    public SettleOrder selectSettleOrderById(Long id) {
        return settleOrderMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateSettleOrderStatusById(Long id, Byte status, Date successTime, Date updateTime, String channelRoyaltyNo) {
        return settleOrderMapper.updateStatusByPrimaryKey(id, status, successTime, updateTime, channelRoyaltyNo);
    }


}
